package com.fzj.example.design.proxy.proxystatic;

/**
* @Description 代理
* @Author  fanzj
* @Date   2020/5/8 9:37 上午
* @Param
* @Return
* @Exception
*
*/
public class Proxy implements Subject {

    private RealSubject realSubject;

    @Override
    public void execute() {
        if(realSubject==null){
            realSubject = new RealSubject();
        }
        //pre
        preExecute();
        //exe
        realSubject.execute();
        //post
        postExecute();
    }

    //pre
    public void preExecute(){
        System.out.println("pre do ...");
    }

    //post
    public void postExecute(){
        System.out.println("post do");
    }

}
